'''
作者：20183215董振龙
文件名称：第九课测试.py
时间：2020年4月29日21点03分
'''
import pymysql
game=pymysql.connect("127.0.0.1","root","156354756954long","gamedb")
cur=game.cursor()
cur.execute('create table game (gamename varchar(20) primary key , gametime int , gameachi int )')
cur.execute('insert into game (gamename,gametime,gameachi) values ("我的世界",56,20)')
cur.execute('select *from game')
row=cur.fetchall()
game.commit()
print(row)
print("---")
cur.execute('insert into game (gamename,gametime,gameachi) values ("人类一败涂地",34,55)')
cur.execute('select *from game')
rows=cur.fetchall()
game.commit()
for row in rows:
    print(row)
print("---")
cur.execute('update game set gametime=70 where gamename="我的世界"')
cur.execute('delete from game where gamename="人类一败涂地"')
cur.execute('select *from game')
rows=cur.fetchall()
game.commit()
for row in rows:
    print(row)





